<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp" %>
<title>Insert title here</title>
</head>
<body>
<fieldset class="layui-elem-field">
  <legend>员工信息修改</legend>
  <div class="layui-field-box">
    <form  class="layui-form layui-form-pane" lay-filter="formA">
    	<div class="layui-form-item">
    	<label class="layui-form-label">员工编号</label>
    	<div class="layui-input-inline">
      		<input type="text" name="code" readonly  autocomplete="off" class="layui-input">
    	</div>
    	</div>
    	
    	<div class="layui-form-item">
    	<label class="layui-form-label">员工姓名</label>
    	<div class="layui-input-inline">
      		<input type="text" name="name"  placeholder="请输入员工姓名"  autocomplete="off" class="layui-input">
    	</div>
    	</div>
    	
    	<div class="layui-form-item">
    	<div class="layui-input-inline">
     	<input type="button" value="确定" class="layui-btn" lay-submit lay-filter="upd">
      	<input type="reset" class="layui-btn layui-btn-primary" >
      	</div>
      	<input type="button" value="关闭" class="layui-btn" onclick="layerClose()" >
  		</div>
  		<input type="hidden" name="action" value="upd" >
    </form>
  </div>
</fieldset>
<script type="text/javascript">

var code = '<%=request.getParameter("code") %>';
init();
function init(){
	ajax("/EmployeeServlet",{code:code,action:'get'},"json",function(data){
		console.log(data)
		
		form.val('formA',{code:data.code,name:data.name,tel:data.tel})
	})
}


formOnSubmit('upd','/EmployeeServlet','text',function(data){
	if(data==1){
			layer.msg("修改成功",layerClose)
		}else{
			layer.msg("修改失败")
		}
})

</script>
</body>
</html>